/**
 * 安卓白金英雄坛制作组 <br>
 * 文件名：RoundOverStatus.java <br>
 * 创建时间：2013-8-7 下午9:22:55 <br>
 * 所属项目：GmudEX <br>
 *
 * @author 12548 <br>
 */
package lostland.gmud.exv2.battle.proc;

import com.orhanobut.logger.Logger;

import lostland.gmud.exv2.battle.BattleScreen;
import lostland.gmud.exv2.battle.StuntData;
import lostland.gmud.exv2.battle.ViewScreen;
import lostland.gmud.exv2.data.Npc;
import lostland.gmud.exv2.data.Room;

/**
 * 类名：RoundOverStatus <br>
 * 说明：回合结束
 *
 * @author 12548
 */
public class RoundOverStatus extends Status {


	/**
	 * @param zdp
	 * @param bdp
	 */
	public RoundOverStatus(Npc zdp, Npc bdp) {
		super(zdp, bdp);
	}

	/*
	 * （非 Javadoc）
	 * @see lostland.gmud.exv2.battle.proc.Status#execute()
	 */
	@Override
	public void execute() {

		zdp.addGauge(1);

		for (int i = 0; i < StuntData.getInstance().size(); i++)
			if (zdp.getSz(i) > 0) {
				zdp.setSz(i, zdp.getSz(i) - 1);
			}

		for (int i = 0; i < 10; i++)
			if (zdp.getBuff(i) > 0) {
				zdp.setBuff(i, zdp.getBuff(i) - 1);
				if (zdp.getBuff(i) == 0) {
					switch (i) {
						case 0:    // 连字诀
							new ViewScreen(BattleScreen
									.bsp(zdp, bdp, "$N剑式一缓，剑上的大小光圈随即不见。")).pushToGame();
							zdp.setEvd_bouns(zdp.getEvd_bouns() - zdp.skills[30] / 10);
							zdp.setHit_bouns(zdp.getHit_bouns() - 10);
							break;
						case 1:    // 化掌为刀1
							new ViewScreen(BattleScreen.bsp(
									zdp, bdp,
									"$N缓缓收回内力，掌法也恢复平常。")).pushToGame();
							zdp.setHit_bouns(zdp.getHit_bouns() - (zdp.skills[1] + zdp.skills[12]) / 20);
							break;
						case 2:    // 三花
							new ViewScreen(BattleScreen.bsp(
									zdp, bdp,
									"$N三花心法用毕，身法也恢复正常。")).pushToGame();
							zdp.setAgi_bouns(zdp.getAgi_bouns() - zdp.skills[20] / 10);
							zdp.setEvd_bouns(zdp.getEvd_bouns()
									- ((zdp.skills[0] + zdp.skills[20] * 2) / 10 - 5));
							break;
						case 3:    // 忍术烟幕
							new ViewScreen(BattleScreen.bsp(zdp, bdp,
									"$n识破了$N的烟幕诡计，攻守自如多了。")).pushToGame();
							bdp.setHit_bouns(bdp.getHit_bouns() + 20);
							break;
						case 4:    // 忍法影分身
							new ViewScreen(BattleScreen.bsp(zdp, bdp,
									"$N忍法影分身运行完毕，制造出来的幻影也跟著消失。")).pushToGame();
							break;
						case 5:    // 冰心诀
							new ViewScreen(BattleScreen.bsp(zdp, bdp,
									"$N冰心决运行完毕，笼罩在身周的护体真气逐渐散去。")).pushToGame();
							zdp.setDef_bouns(zdp.getDef_bouns() - (zdp.skills[0] + zdp.skills[36] * 2)
									/ 8);
							break;
						case 6:    // 化掌为刀2
							new ViewScreen(BattleScreen.bsp(
									zdp, bdp,
									"$N缓缓收回内力，掌法也恢复平常。")).pushToGame();
							zdp.setStr_bouns(zdp.getStr_bouns() - zdp.skills[13] / 5);
							zdp.setHit_bouns(zdp.getHit_bouns() - zdp.skills[13] / 10);
							break;
						case 7:    // 飞鹰召唤
							new ViewScreen(BattleScreen.bsp(zdp, bdp,
									"铁爪苍鹰一声嘶啸，转了个圈渐渐地飞远了。")).pushToGame();
							zdp.setAgi_bouns(zdp.getAgi_bouns() - zdp.skills[47] / 10);
							zdp.setEvd_bouns(zdp.getEvd_bouns()
									- ((zdp.skills[1] + zdp.skills[47] * 2) / 10 - 5));
							break;
						case 8:    // 闪展腾挪
							new ViewScreen(BattleScreen.bsp(zdp, bdp,
									"$N功力不够，再坚持下去怕有走火入魔之祸，只能暂时休息一下了。")).pushToGame();
							zdp.setHit_bouns(zdp.getHit_bouns() - zdp.skills[50] / 10);
							zdp.setEvd_bouns(zdp.getEvd_bouns()
									- ((zdp.skills[0] + zdp.skills[50] * 2) / 10 - 5));
							BattleScreen.getInstance().qkdny1 = false;
							break;
						case 9: // 金龙束缚
							new ViewScreen(BattleScreen.bsp(zdp, bdp,
									"$n摆脱了$N的束缚，攻守自如多了。")).pushToGame();
							bdp.setHit_bouns(bdp.getHit_bouns() + 10);
							bdp.setAgi_bouns(bdp.getAgi_bouns() + 10);
							bdp.setEvd_bouns(bdp.getEvd_bouns() + 10);
						case 10:
							new ViewScreen(BattleScreen.bsp(zdp, bdp,
									"$n冲开了穴道，恢复了力气。")).pushToGame();
							bdp.setStunt(true);
					}


					pushToBattle();
// Gmud.bs.push(new DummyStatus());

					return;
				}
			}

		bdp.setTemp_dmg_multiplier(1.0);

		Logger.i("doing");

		BattleScreen.getInstance().setStatus(new RoundOverStatus(bdp, zdp));
		new FreeStatus(bdp, zdp).pushToBattle();

		if (bdp.haveTalent(125)) // 天赋效果125
		{
			new FreeStatus(bdp, zdp).pushToBattle();
			new FreeStatus(bdp, zdp).pushToBattle();
		}

		if (bdp.haveTalent(80)) // 天赋效果80
		{
			bdp.setStr_bouns(bdp.getStr_bouns() + 2);
			bdp.rec((int) (bdp.getAttr(Room.ATTR_MAXHP) * 0.1));
		}

	}

}
